package com.kuang.dao;

import com.kuang.pojo.Department;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @Auther: dlh
 * @Date: 2020/12/14
 * @ClassName: DepartmentDao
 * @Describle: 技术在灵魂面前必输
 * @Version:1.0
 **/
public class DepartmentDao {
    private static Map<Integer, Department> departments = null;   //构建部门表

    //创建数据库department表
    static {
        departments = new HashMap<Integer, Department>();
        departments.put(101, new Department(101, "教学部"));
        departments.put(102, new Department(102, "市场部"));
        departments.put(103, new Department(103, "教研部"));
        departments.put(104, new Department(104, "运营部"));
        departments.put(105, new Department(105, "后勤部"));
    }

    //获得部门信息
    public Collection<Department> getDepartments() {
        return departments.values();
    }
    public Department getDepartmentById(Integer id){
        return departments.get(id);
    }
}
